/**
 * 
 */
package cc.rico.utils;

import org.apache.shiro.authc.credential.HashedCredentialsMatcher;

/**
 * hashedCredentialsMatcher 加密工具
 * 
 * @author JiWo 2016年6月24日
 *
 */
public class HashedCredentialsMatcherUtil {

	private static final String HASH_ALGORITHM = "MD5";
	private static final int HASH_ITERATIONS = 1;
	private static final boolean HASH_SALTED = true;
	private static final boolean STORED_CREDENTIALS_HEX_ENCODE = true;

	private String hashAlgorithm = HASH_ALGORITHM;
	private int hashIterations = HASH_ITERATIONS;
	private boolean hashSalted = HASH_SALTED;
	private boolean storedCredentialsHexEncoded = STORED_CREDENTIALS_HEX_ENCODE;
	
	private HashedCredentialsMatcher credentialsMatcher;
	
	public HashedCredentialsMatcherUtil() {
		credentialsMatcher = new HashedCredentialsMatcher();
		credentialsMatcher.setHashAlgorithmName(hashAlgorithm);
		credentialsMatcher.setHashIterations(hashIterations);
		//credentialsMatcher.setHashSalted(hashSalted);
		credentialsMatcher.setStoredCredentialsHexEncoded(storedCredentialsHexEncoded);
	}
	
	public String encode(String credentials) {
		String ret = null;
		
		return ret;
	}
	
	public String encode(byte[] credentials) {
		String ret = null;
		
		return ret;
	}

	public String getHashAlgorithm() {
		return hashAlgorithm;
	}

	public void setHashAlgorithm(String hashAlgorithm) {
		this.hashAlgorithm = hashAlgorithm;
	}

	public int getHashIterations() {
		return hashIterations;
	}

	public void setHashIterations(int hashIterations) {
		this.hashIterations = hashIterations;
	}

	public boolean isHashSalted() {
		return hashSalted;
	}

	public void setHashSalted(boolean hashSalted) {
		this.hashSalted = hashSalted;
	}

	public boolean isStoredCredentialsHexEncoded() {
		return storedCredentialsHexEncoded;
	}

	public void setStoredCredentialsHexEncoded(
			boolean storedCredentialsHexEncoded) {
		this.storedCredentialsHexEncoded = storedCredentialsHexEncoded;
	}

}
